/**
* @Title LemurCMS Message Plugin for jQuery
* @Date 5/26/2009
* @Author Ramblingwood
*/
(function($) {
	$.fn.cmsMessage = function (options, title, content) {
		return this.each(function () {
			var $orginal = $(this);
			if(typeof options == 'object') {
				var opts = $.extend({}, $.fn.cmsMessage.defaults, options);
			}
			else if (typeof options == 'string') {
				var opts = new Object();
				opts.type = options;
				opts.title = title;
				opts.content = content;
			}
			var lemurcms_message = "<div class='message-wrapper";
			if(opts.small == true)
				lemurcms_message += " message-small";
			else
				lemurcms_message += " message-large";
			lemurcms_message += "'>";
			var r = '';
			switch (opts.type) {
				case 'message':
					r += "<div class='message-message message'>\n\t<div class='message-message-header message-header'>"+opts.title+"</div>\n\t<div class='message-message-content message-content'>\n\t\t<p>"+opts.content+"</p>\n\t</div>\n</div>";
					break;
				case 'success':
					r += "<div class='message-ok message'>\n\t<div class='message-ok-header message-header'>"+opts.title+"</div>\n\t<div class='message-ok-content message-content'>\n\t\t<p>"+opts.content+"</p>\n\t</div>\n</div>";
					break;
				case 'error':
					r += "<div class='message-error message'>\n\t<div class='message-error-header message-header'>"+opts.title+"</div>\n\t<div class='message-error-content message-content'>\n\t\t<p>"+opts.content+"</p>\n\t</div>\n</div>";
					break;
				case 'warning':
					r += "<div class='message-warning message'>\n\t<div class='message-warning-header message-header'>"+opts.title+"</div>\n\t<div class='message-warning-content message-content'>\n\t\t<p>"+opts.content+"</p>\n\t</div>\n</div>";
					break;
			}
			lemurcms_message = lemurcms_message + r + '</div>';
			$orginal.html(lemurcms_message);
		});
	};
	$.fn.cmsMessage.defaults = {
		type   : 'message',
		title  : 'Title',
		content: 'Content',
		small  : false
	};
})(jQuery);
